<script type="text/javascript">
$(function () {
	var url = '${contextPath}script/oa/reimburseManager.js';
	$.ajax({url:url, dataType:'script', cache:true,
		success: function(){
		}
	});
})

function transfer_reimburseManager() {
	var cu = $('#au').val();
	var code = $('#reimburse_code').val();
	var pc = $('#pc').val();
	if (code == null || pc == ''){
		return false;
	}
	console.log(code,pc);
	var parm =  {'code':code, 'pc': pc, 'cu':cu};
	var url = create_url('reimburseManager-transfer');
	$.ajax({type:'POST',url:url, data:parm,
		success:function (result) {
				sys_submiting_close();
			if (result == 'success') {
				sys_msg('操作成功!');
				$.fn.colorbox.close();
				sys_load_handle('reimburseManager');
			} else if (result == 'parameter_error') {
				sys_msg('请选择移交人员!');
			} else {
				sys_msg('操作失败!');
			}
		}
	});
}

</script>
<div class="widget" style="margin:0px;">
	<div class="widget-content">
		<div class="table-title">
		<form id="editForm">
			<input type="hidden" id="reimburse_code" value="${(reimburse.code)!''}"/>
			<table class="table table-bordered animate2 fadeInUp" style="width:50%; text-align:left;">
				<tr>
					<td class="table-left" style="width:80px;">申请部门:</td>
					<td>${(reimburse.on)!''}</td>
				</tr>
				<tr>
					<td class="table-left" style="width:80px;">申请人：</td>
					<td>${(reimburse.cn)!''}</td>
				</tr>
				<tr>
					<td class="table-left">标题:</td>
					<td>${(reimburse.title)!''}</td>
				</tr>
				<tr>
					<td class="table-left">备注:</td>
					<td>${(reimburse.remark)!''}</td>
				</tr>
				<#list reimburse.auditStatusList as items>
				<#if items.pc gt pc + 1>
				<tr>
					<td class="table-left">移交:</td>
					<td>
						<div class="input-append">
							<input type="text" id="auName" name="auName"  value="${(items.auName)!''}" readonly/>
							<input type="hidden" id="au" name="au" value="${(items.au)!''}">
							<button class="btn btn-xs btn-primary" type="button" onclick="javascript:selectedUser_reimburseManager('${au}', '${auName}');return false;"><i class="icon-search"></i></button>
						</div>
					</td>
				</tr>
				</#if>
				</#list>
				<tr>
					<#list reimburse.auditStatusList as list>
					<#if list.status == 2>
						<td class="table-left">原因</td>
						<td><textarea id="remark" name="remark">${(list.remark)!''}</textarea></td>
					<#elseif list.status == 1>
					<#else>
						<td class="table-left">原因</td>	
						<td><textarea id="remark" name="remark" placeholder="驳回的话请你填写原因"></textarea></td>
					</#if>
					</#list>
				</tr>
			</table>
			<table style="width:50%; margin-top:10px;" class="table table-bordered animate2 fadeInUp">
				<thead>
					<tr>
						<th style="text-align:center; width:120px;">报销项目</th>
						<th style="text-align:center; width:120px;">项目类别</th>
						<th style="text-align:center; width:42px;">金额</th>
						<th style="text-align:center; width:50px;">票据(张)</th>
						<th style="text-align:center;">费用明细</th>
					</tr>
				</thead>
				<tbody id="applyDetailListBody">
				<#if ((reimburse.itemList)?? && reimburse.itemList?size > 0)>
					<#list reimburse.itemList as item>
						<tr class="rep">
							<td style="text-align:center;">${(item.project)!''}</td>
							<td>${(item.rcn)!''}</td>
							<td>${(item.amount)!''}</td>
							<td>${(item.num)!''}</td>
							<td>${(item.remark)!''}</td>
						</tr>
					</#list>
				</#if>
				</tbody>
				<#if (reimburse.auditStatusList?? && reimburse.auditStatusList?size gt 0)>
					<#list reimburse.auditStatusList as item>
					<input id="pc" value="${(item.pc)!''}" type="hidden"/>
						<#if item.au??>
							<tr>
								<td colspan="6" style="text-align:center; color: red">已审核</td>
							</tr>
							<tr>
								<td colspan="6" style="text-align:center;"><a class="btn btn-info" href="javascript:;" onclick="javascript:history.back(); return false;">关闭</a></td>
							</tr>
						<#else>
							<tr>
								<td colspan="6" style="text-align:center;">
									<a class="btn btn-info" href="javascript:;" title="${(reimburse.title)!''}" pic="${(reimburse.code)!''}" onclick="javascript: updateDesignate1_reimburseManager($('#reimburse_code').val()); return false;">通过</a>
									&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
									<a class="btn btn-info" href="javascript:;" onmousemove="javascript:check_reimburseManager();" title="${(reimburse.title)!''}" pic="${(reimburse.code)!''}" onclick="javascript: updateDesignate2_reimburseManager($('#reimburse_code').val());">驳回</a>
								<#if item.pc gt pc + 1>
								&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
									<a class="btn btn-success" href="javascript:;" onclick="javascript: transfer_reimburseManager();">移交</a>
								</#if>
								</td>
							</tr>
							<#break/>
						</#if>
					</#list>
				</#if>
			</table>
			</form>
		</div>
	</div>
</div>